﻿@using hc.epm.ViewModel;
@using System.Collections.Generic;
@model List<SupervisorLogStatisticView>
@{
    ViewBag.Title = "Index";
}

<div class="contentData">
    <div class="form-select c">
        <form method="get" class="layui-form" style="padding-top:0px;">
            <div>
                <div>
                    <label>项目名称 : </label><input type="text" id="projectName" name="projectName" value="@ViewBag.projectName">
                </div>
                <div>
                    <label>供应商 : </label><input type="text" id="companyName" name="companyName" value="@ViewBag.companyName">
                </div>
                <div>
                    <label>分公司名称 : </label><input type="text" id="crtCompanyName" name="crtCompanyName" value="@ViewBag.crtCompanyName">
                </div>
                <div style="margin-left: 28px;">
                    <label>姓名 : </label><input type="text" id="pm" name="pm" value="@ViewBag.pm">
                </div>
            </div>
            <div class="form-sub">
                <button type="submit" id="btnsel">查询</button>
            </div>
        </form>
    </div>
    <div>
        <table class="datalist" style="word-break:break-all;word-wrap:break-word">
            <thead>
                <tr>
                    <th width="50">序号</th>
                    <th>姓名</th>
                    <th>所属供应商</th>
                    <th>所属项目</th>
                    <th>项目所属分公司</th>
                    @*<th>工程分类</th>
                        <th>提交时间</th>*@
                    <th>入场天数</th>
                    <th>考勤情况(实际提交/入场天数)</th>
                </tr>
            </thead>
            <tbody>
                @{
                    int index = (ViewBag.pageIndex - (ViewBag.pageIndex - 1)) * ((ViewBag.pageIndex - 1) * 10);
                    //var count = Model.Count();
                }
                @if (Model != null && Model.Count() > 0)
                {
                    foreach (var item in Model)
                    {
                        index++;
                        <tr>
                            <td>@index</td>
                            <td>@item.pm</td>
                            <td>@item.companyName</td>
                            <td>@item.projectName</td>
                            <td>@item.crtCompanyName</td>
                            @*<td>@item.type</td>
                                <td>@item.submitTime</td>*@
                            <td>@item.limit</td>
                            <td>@item.ActualDays/@item.limit</td>
                        </tr>
                    }
                }
            </tbody>
        </table>
    </div>
    <div id="page" style="text-align:right; margin-right:5px;">
    </div>
</div>
<script>
    //若无数据隐藏分页组件
    if ('@ViewBag.Total' == 0) {
        $("#page").hide();
    }
    layui.use(['layer', 'form', 'element', 'laypage'], function () {
        var layer = layui.layer, form = layui.form, element = layui.element, $ = layui.jquery, laypage = layui.laypage;
        //分页
        laypage.render({
            elem: 'page',
            count: '@ViewBag.Total',
            curr: '@ViewBag.pageIndex',
            layout: ['prev', 'page', 'next', 'skip', 'count'],
            jump: function (obj, first) {
                if (!first) {
                    //得到了当前页，用于向服务端请求对应数据
                    var curr = obj.curr;
                    var search = $("form").serialize();
                    window.location.href = "/SupervisorLogStatistic/Index?pageIndex=" + curr + "&" + search;
                }
            }
        });
    });
</script>